Linux更改文件文件夹所属用户组(chgrp)

您所在的位置:网站首页 linux 文件修改用户组 Linux更改文件文件夹所属用户组(chgrp)

Linux更改文件文件夹所属用户组(chgrp)

#Linux更改文件文件夹所属用户组(chgrp)| 来源: 网络整理| 查看: 265

更改所属用户组

, chgrp 

 

改变文件的用户组很简单,直接用

chgrp

即可,这个命令就是

change group

(改变用户组)

的缩写。这样就很好记了。不过,请记住,要改变成为的用户组名称,必须在

 

/etc/group

存在,否则就会显示错误。

 

 

假设以

root

的身份登入

FC4

,那么,在你的家目录内有一个

install.log

文件,如何改变该文

件的用户组呢?假设你已经知道在

 

/etc/group

里已经存在一个名为

users

的用户组,但是,

testing

这个用户组名字就不存在

 

/etc/group

中了,此时改变用户组成为

users

testing

,会

有什么现象发生呢?

 

 

 

[root@linux ~]# chgrp [-R] dirname/filename ...

参数:

-R : 

进行递归

( recursive )

的持续更改,

即连同子目录下的所有文件、目录都更新成为这个用户组。常常用在更改某一目录的情况。

范例:

[root@linux ~]# chgrp users install.log[root@linux ~]# ls -l-rw-r--r-- 

 

1 root users 68495 

Jun 

25 

08:53 

install.log[root@linux 

~]# 

chgrp 

testing 

install.logchgrp: 

invalid 

group 

name 

`testing' 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3